<template>
	<!-- #ifdef APP -->
	<view style="padding-bottom:80upx;padding-top: 120upx;">
	<!-- #endif -->
		<!-- #ifndef APP -->
		<view style="padding-bottom: 80upx;">
		<!-- #endif -->

			<view class="swiper" v-if="swiperList.length>0">
				<swiper :indicator-dots="false" :circular="true" :autoplay="true" :interval="5000" :duration="1000">
					<swiper-item v-for="(item,index) in swiperList" :key="index">
						<image @click="gotoNavSwiper(item.url)" :src="item.imageUrl" style="width: 100%;"
							mode="widthFix"></image>
					</swiper-item>
				</swiper>
			</view>

			<!-- #ifdef H5 -->
			<view class="flex align-center padding-lr padding-top">
			<!-- #endif -->
				<!-- #ifndef H5 -->
				<view class="flex align-center padding-lr padding-top">
				<!-- #endif -->

					<view class="u-m-r-10">
						<image :src="avatar" style="width: 100rpx;height: 100rpx;border-radius: 100rpx;"
							@click="goNav('/pages/my/userinfo')"></image>
					</view>
					<view class="u-flex-1 u-m-l-10 text-white " v-if="!isLogin">
						<view class="margin-left-sm">{{userName}}</view>
						<view class="flex" style="font-size: 22rpx;font-weight: 500;">
							<view v-if="geRen == 0" class="round  u-font-12" @click.stop="goNav('/my/renzheng/types')"
								style="display: inline-block;background-color: #F2F2F2; color: #666666;padding: 2upx 16upx;font-weight: 400;">
								未入驻
							</view>
							<view v-else-if="geRen == 1" class="round  u-font-12"
								@click.stop="goNav('/my/renzheng/index?authentication='+authentication)"
								style="display: inline-block;background-color: #F2F2F2; color: #666666;padding: 2upx 16upx;font-weight: 400;">
								审核中
							</view>
							<view v-else-if="geRen == 2" class="round  u-font-12"
								style="display: inline-block;background-color: #F2F2F2; color: #666666;padding: 2upx 16upx;font-weight: 400;">
								已入驻
							</view>
							<view v-else-if="geRen == 3" class="round  u-font-12"
								@click.stop="goNav('/my/renzheng/index?authentication='+authentication)"
								style="display: inline-block;background-color: #F2F2F2; color: #666666;padding: 2upx 16upx;font-weight: 400;">
								已拒绝
							</view>
						</view>
					</view>
					<view v-else class="text-xl u-p-l-20 text-bold" @click="goLogin('/pages/public/login')">
						登录
					</view>
				</view>
				<view class="flex align-center padding-left">
					<image src="../../static/images/data.png" style="width: 26upx;height: 26upx;"></image>
					<view class="margin-left-xs flex align-center" style="color: #999999;">
						<view @click="bindData(1)">{{startTime?startTime:'开始时间'}}</view>
						至
						<view @click="bindData(2)">{{endTime?endTime:'结束时间'}}</view>
					</view>
				</view>
				<view class="flex align-center box justify-between text-center">
					<view class="">
						￥<text class="text-bold text-xl">{{sumOrdersMoney?sumOrdersMoney:'0'}}</text>
						<view>总收益</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">{{sumOrdersCount?sumOrdersCount:'0'}}</text>
						<view>总销量</view>
					</view>
					<view class="">
						<text class="text-bold text-xl">{{sumOrdersScore?sumOrdersScore:'0'}}</text>
						<view>用户评分</view>
					</view>
					<!-- <view class="">
				<text class="text-bold text-xl">{{shangCount+ xiaCount}}</text>
				<view>服务发布</view>
			</view> -->
				</view>
				<view class="padding">
					<view class="text-bold text-lg margin-bottom-sm">订单数据</view>
					<view class="orderbox ">
						<view class="">
							￥<text class="text-bold text-xl">{{ordersMoney?ordersMoney:'0'}}</text>
							<view class="margin-top-xs">订单收入</view>
						</view>
						<view class="">
							<text class="text-bold text-xl">{{ordersCount?ordersCount:'0'}}</text>
							<view class="margin-top-xs">总订单数</view>
						</view>
						<view class="">
							￥<text class="text-bold text-xl">{{refundMoney?refundMoney:'0'}}</text>
							<view class="margin-top-xs">退款金额</view>
						</view>
						<!-- <view class="">
					<text class="text-bold text-xl">{{userBrowseCount?userBrowseCount:'0'}}</text>
					<view class="margin-top-xs">访客人数</view>
				</view> -->
					</view>
				</view>
				<view style="padding: 0upx 30upx;">
					<view class="text-bold text-lg margin-bottom-sm flex justify-between">
						<view>订单管理</view>
						<view @click="goDetail(1)">
							<text style="color: #666666;font-size: 26upx;margin-right: 10upx;">查看全部</text>
							<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
						</view>
					</view>
					<view class="orderbox ">
						<!-- <view class="">
					<text class="text-bold text-xl">{{countOrderIng?countOrderIng:'0'}}</text>
					<view class="margin-top-xs">待接单</view>
				</view> -->
						<view class="">
							<text class="text-bold text-xl">{{ ordersUnderwayCount?ordersUnderwayCount:'0'}}</text>
							<view class="margin-top-xs">待完成</view>
						</view>
						<view class="">
							<text class="text-bold text-xl">{{ordersAccomplishCount?ordersAccomplishCount:'0'}}</text>
							<view class="margin-top-xs">已完成</view>
						</view>
						<view class="">
							<text class="text-bold text-xl">{{commentCount?commentCount:'0'}}</text>
							<view class="margin-top-xs">已评价</view>
						</view>
					</view>
				</view>
				<!-- <view class="padding">
			<view class="text-bold text-lg margin-bottom-sm flex justify-between">
				<view>我的服务</view>
				<view @click="goDetail(2)">
					<text style="color: #666666;font-size: 26upx;margin-right: 10upx;">查看全部</text>
					<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
				</view>
			</view>
			<view class="orderbox ">
				<view class="">
					<text class="text-bold text-xl">{{shangCount?shangCount:'0'}}</text>
					<view class="margin-top-sm">上架中</view>
				</view>
				<view class="">
					<text class="text-bold text-xl">{{ xiaCount? xiaCount:'0'}}</text>
					<view class="margin-top-sm">已下架</view>
				</view>
				<view @click="bindFb()">
					<image src="../../static/images/index/add.png" style="width: 46upx;height: 46upx;"></image>
					<view class="margin-top-xs">添加服务</view>
				</view>

			</view>
		</view> -->
				<view class="padding-lr margin-top">
					<view class="text-bold text-lg margin-bottom-sm flex justify-between">
						<view>今日订单</view>
						<view @click="goDetail(2)">
							<text style="color: #666666;font-size: 26upx;margin-right: 10upx;">查看全部</text>
							<image src="../../static/images/back.png" style="width: 12upx;height: 20upx;"></image>
						</view>
					</view>
					<view class="tadyOrder" v-for="(item,index) in orderlist" :key="index"
						@click="bindtakeDetail(item.ordersId)">
						<view class="tadyOrder-left">
							<view class="tadyOrder-left-t">今日</view>
							<view class="tadyOrder-left-b">
								{{item.appointInformation.hopeTime}}
								<!-- 14:30-15:30 -->
							</view>
						</view>
						<view class="tadyOrder-right">
							<view class="tadyOrder-right-t">
								{{item.appointInformation.serviceName}}{{item.appointInformation.hospitalName}}订单
							</view>
							<view class="tadyOrder-right-b"
								@tap.stop="bindGps(item.latitude,item.longitude,item.province,item.city,item.district,item.detailsAddress)">
								<u-icon name="map-fill" color="#0175FE" size="28"></u-icon>
								<span style="margin-left: 5rpx;">
									<!-- {{item.city}} -->
									就诊医院:{{item.appointInformation.hospitalName}}
								</span>
							</view>
						</view>
					</view>
					<empty v-if="orderlist.length==0" content="暂无订单"></empty>
				</view>
				<!-- 开始时间 -->
				<u-picker v-model="startshow" mode="time" :params="paramsStart" @confirm="startData"></u-picker>
				<!-- 结束时间 -->
				<u-picker v-model="endshow" mode="time" :params="paramsEnd" @confirm="endData"></u-picker>
				<uni-popup ref="popusAuthorization" type="center" :maskClick="false">
					<view class="contentview">
						<view class="title">隐私保护指引</view>
						<view class="des" @click="openPrivacyContract">
							在使用当前小程序服务之前，请仔细阅读<text
								style="color: #5074FF;">{{privacyContractName}}</text>。如你同意{{privacyContractName}}，请点击“同意”开始使用。
						</view>
						<view class="btns">
							<button class="item reject" @click="exitMiniProgram">拒绝</button>
							<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization"
								@agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
						</view>
					</view>
				</uni-popup>
			</view>
</template>

<script>
	import empty from '@/components/empty.vue'
	export default {
		components: {
			empty
		},
		onShareAppMessage(res) {
			return {
				path: '/pages/index/index?invitation=' + this
					.invitationCode, //这是为了传参   onload(data){let id=data.id;} 
				title: this.tuiName,
				imageUrl: this.tuiImage
			}
		},
		/*
		 * uniapp微信小程序分享页面到微信朋友圈
		 */
		onShareTimeline(res) {
			return {
				path: '/pages/index/index?invitation=' + this.invitationCode, //这是为了传参   onload(data){let id=data.id;} 
				title: this.tuiName,
				imageUrl: this.tuiImage
			}
		},
		data() {
			return {
				avatar: '../../static/logo.png',
				isLogin: true,
				userName: '匿名',
				renzheng: 0,
				startshow: false,
				endshow: false,
				paramsStart: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				paramsEnd: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				startTime: '',
				endTime: '',
				orderlist: [],
				sumOrdersMoney: 0, //总收益
				sumOrdersCount: 0, //总销量
				sumOrdersScore: 0, //用户评价数
				ordersMoney: 0, //订单收入
				ordersCount: 0, //总订单数
				refundMoney: 0, //退款金额
				userBrowseCount: 0, //访客人数
				// countOrderIng: 0, //待接单
				ordersUnderwayCount: 0, //待完成
				ordersAccomplishCount: 0, //已完成
				commentCount: 0, //已评价
				shangCount: 0, //上架中
				xiaCount: 0, //下架中
				page: 1,
				pages: 1,
				limit: 10,
				longitude: '',
				latitude: '',
				isTrue: true,
				showModal: true,
				userId: '',
				arr: [],
				city: '',
				isCashDeposit: 0,
				geRen: 0,
				classify: 1,
				authentication: 1,
				swiperList: [], //轮播图
				tuiName: '',
				tuiImage: '',
				invitationCode: '',
				privacyContractName: '',
			}
		},
		onLoad(e) {
			// #ifdef MP-WEIXIN
			try {
				wx.getPrivacySetting({
					success: res => {
						console.log("是否需要授权：", res.needAuthorization, "隐私协议的名称为：", res.privacyContractName)
						if (res.needAuthorization) {
							this.privacyContractName = res.privacyContractName;
							this.$refs.popusAuthorization.open();
						}
					},
					fail: () => {},
					complete: () => {},
				})
			} catch (e) {
				//TODO handle the exception
			}

			// #endif
			this.userId = uni.getStorageSync('userId')
			this.classify = uni.getStorageSync("classify")
			this.getSwiperImg()
			let that = this
			// 分享
			// 获取邀请码保存到本地
			if (e.invitation) {
				that.$queue.setData('inviterCode', e.invitation);
			}
			// #ifdef MP-WEIXIN
			if (e.scene) {
				const scene = decodeURIComponent(e.scene);
				that.$queue.setData('inviterCode', scene.split(',')[0]);
			}
			// #endif
			if (this.userId) {
				that.invitationCode = uni.getStorageSync('invitationCode')
				that.$Request.getT('/app/common/type/276').then(res => { //分享标题 276
					if (res.code == 0) {
						that.tuiName = res.data.value
					}
				})
				that.$Request.getT('/app/common/type/277').then(res => { //分享图 277
					if (res.code == 0) {
						that.tuiImage = res.data.value
					}
				})
			}

		},
		onShow() {
			this.userId = uni.getStorageSync('userId')
			this.geRen = uni.getStorageSync("geRen")
			if (this.geRen == 2) {
				this.renzheng = false
			} else {
				this.renzheng = true
			}
			this.isCashDeposit = uni.getStorageSync('isCashDeposit')
			if (this.userId) {
				this.isLogin = false
				this.getUserInfo()
				this.getRenZheng()
				this.getFb()
				this.getfuOrder()
				this.page = 1
				this.getTodayOrder()

				// #ifdef MP-WEIXIN
				//订单变更通知
				this.$Request.getT('/app/common/type/312').then(res => { //订单变更通知 312
					if (res.code == 0) {
						if (res.data && res.data.value) {
							this.arr.push(res.data.value)
						}
					}
				})
				this.$Request.getT('/app/common/type/352').then(res => { //绑定通知 352
					if (res.code == 0) {
						if (res.data && res.data.value) {
							this.arr.push(res.data.value)
						}
					}
				})

			


				if (this.showModal) {
					this.openMsg()
				}
				// #endif
			} else {
				this.isLogin = true
				this.userName = '匿名'
				this.browse = 0
				this.fans = 0
				this.follow = 0
				this.visitor = 0
				this.avatar = '../../static/logo.png'
				this.sumOrdersMoney = 0 //总收益
				this.shangCount = 0 //上架中
				this.xiaCount = 0 //下架中
				this.sumOrdersCount = 0 //总销量
				this.sumOrdersScore = 0 //用户评价
				this.ordersMoney = 0 //订单收入
				this.ordersCount = 0 //总订单数
				this.refundMoney = 0 //退款金额
				this.userBrowseCount = 0 //访客人数

				this.ordersAccomplishCount = 0 //已完成
				this.commentCount = 0 //已评价
				this.ordersUnderwayCount = 0 //待完成
			}
			let that = this
			setInterval(function() {
				that.getfuOrder()
			}, 10000 * 1000) //修改时间++++++++++++++++++++++ 原10000

		},
		methods: {
			// 打开隐私协议页面
			openPrivacyContract() {
				let that = this;
				wx.openPrivacyContract({
					fail: () => {
						that.$queue.showToast('遇到错误无法打开！');
					}
				})
			},
			// 拒绝隐私协议
			exitMiniProgram() {
				// 直接退出小程序
				wx.exitMiniProgram()
			},
			// 同意隐私协议
			handleAgreePrivacyAuthorization() {
				this.$refs.popusAuthorization.close();
			},
			//轮播图跳转
			gotoNavSwiper(url) {
				// #ifdef MP-WEIXIN
				if (uni.getStorageSync('sendMsg')) {
					console.log('授权+1')
					wx.requestSubscribeMessage({
						tmplIds: this.arr,
						success(re) {
							console.log(JSON.stringify(re), 111111111111)
							var datas = JSON.stringify(re);
							if (datas.indexOf("accept") != -1) {
								console.log(re)
							}
						},
						fail: (res) => {
							console.log(res)
						}
					})
				}
				// #endif
				let urlMap = [
					'/pages/order/order',
					'/pages/order/index',
					'/pages/my/index'
				]
				if (urlMap.indexOf(url) != -1) {
					uni.switchTab({
						url: urlMap[urlMap.indexOf(url)]
					})
				} else if (url.indexOf('http') != -1) {
					//http/https外部页面
					//#ifndef H5
					uni.navigateTo({
						url: '/my/webView/webView?url=' + url
					})
					//#endif
					//#ifdef H5
					window.location.href = url;
					//#endif
				} else if (url.indexOf('客服') != -1) {
					this.Changekefu()
				} else {
					if (uni.getStorageSync('token')) {
						uni.navigateTo({
							url: url
						})
					} else {
						uni.showModal({
							title: '提示',
							content: '您还未登录,请先登录',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									uni.navigateTo({
										url: '/pages/public/login'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					}
				}


			},
			Changekefu() {
				let SelKeFu = this.$queue.getData('SelKeFu');
				if (SelKeFu + '' == '1') { //手机号
					uni.makePhoneCall({
						phoneNumber: uni.getStorageSync('kefuPhone')
					});
				} else if (SelKeFu + '' == '2') { //企业微信
					let that = this
					// #ifdef MP-WEIXIN
					wx.openCustomerServiceChat({
						extInfo: {
							url: that.$queue.getData('kefu')
						},
						corpId: that.$queue.getData('kefuAppId'),
						success(res) {}
					})
					// #endif
					// #ifdef H5
					window.location.href = that.$queue.getData('kefu');
					// #endif
					// #ifdef APP
					let kefu = that.$queue.getData('kefu')
					console.log(kefu)
					plus.runtime.openURL(kefu, function(res) {});
					// #endif
				} else { //客服二维码页面
					uni.navigateTo({
						url: '/my/kefu/kefu'
					})
				}
			},
			//获取轮播图
			getSwiperImg() {
				this.$Request.get("/app/banner/selectBannerList", {
					classify: 11
				}).then(res => {
					if (res.code == 0) {
						this.swiperList = res.data
					}
				});
			},
			// 接单详情
			bindtakeDetail(id) {
				uni.navigateTo({
					url: '/my/order/pay?id=' + id
				})
			},
			// 一键导航
			bindGps(latitude, longitude, province, city, district, address) {
				uni.openLocation({
					latitude: latitude - 0, //要去的纬度-地址       
					longitude: longitude - 0, //要去的经度-地址
					name: address, //地址名称
					address: province + '' + city + '' + district + '' + address, //详细地址名称
					success: function() {
						console.log('导航成功');
					},
					fail: function(error) {
						console.log(error)
					}
				});
			},
			// 获取新服务订单消息提醒
			getfuOrder() {
				this.$Request.getT("/app/orders/getOrdersRemind").then(res => {
					if (res.code == 0) {
						if (res.data == 1) {
							this.aplayAudio()
						}
					}
				});
			},
			aplayAudio() {
				// console.log('语音提示')
				const innerAudioContext = uni.createInnerAudioContext();
				innerAudioContext.autoplay = true;
				// innerAudioContext.src =
				// 	'https://pw.xianmxkj.com/file/uploadPath/2022/01/19/0753211f78d718d44ee6372e33eae9ee.mp3';
				innerAudioContext.src =
					'https://pw.xianmxkj.com/file/uploadPath/2022/03/25/c9bc6a731dec661f06d4122dfcb3141c.mp3';

				innerAudioContext.onPlay(() => {
					console.log('开始播放');
				});
				innerAudioContext.onError((res) => {
					console.log(res.errMsg);
					console.log(res.errCode);
				});
			},
			getcity() {
				let that = this
				uni.getLocation({
					type: 'wgs84',
					success: function(res) {
						console.log('当前位置的经度：' + res.longitude);
						console.log('当前位置的纬度：' + res.latitude);
						that.latitude = res.latitude
						that.longitude = res.longitude
						that.getcitys()
					}
				});
			},
			getcitys() {
				this.$Request.get('/app/Login/selectCity?lat=' + this.latitude + '&lng=' + this.longitude).then(res => {
					if (res.code == 0) {
						this.city = res.data.city ? res.data.city : '未知'
					}
				});
			},
			//获取技师的信息
			getArtificer() {
				this.$Request.getT("/app/artificer/selectArtificer").then(res => {
					if (res.code == 0) {

						if (res.data.status == 1) {
							this.isTrue = true
						} else if (res.data.status == 2) {
							this.isTrue = false
						}
						uni.setStorageSync('artificerId', res.data.artificerId)
					}
				});
			},
			//获取用户发布
			getFb() {
				let data = {
					startTime: this.startTime,
					endTime: this.endTime,
				}
				this.$Request.get("/app/orderTaking/selectShopData", data).then(res => {
					uni.stopPullDownRefresh();
					if (res.code == 0) {
						this.sumOrdersMoney = res.data.sumOrdersMoney //总收益
						this.shangCount = res.data.shangCount //上架中
						this.xiaCount = res.data.xiaCount //下架中
						this.sumOrdersCount = res.data.sumOrdersCount //总销量
						// this.sumOrdersScore = res.data.sumOrdersScore //用户评价
						this.ordersMoney = res.data.ordersMoney //订单收入
						this.ordersCount = res.data.ordersCount //总订单数
						this.refundMoney = res.data.refundMoney //退款金额
						this.userBrowseCount = res.data.userBrowseCount //访客人数
						// this.countOrderIng = res.data.countOrderIng //进行中
						this.ordersAccomplishCount = res.data.ordersAccomplishCount //已完成
						this.commentCount = res.data.commentCount //已评价
						this.ordersUnderwayCount = res.data.ordersUnderwayCount //待完成
					}
				})
			},
			//获取今日订单
			getTodayOrder() {
				let userId = uni.getStorageSync('userId')
				let data = {
					page: this.page,
					limit: this.limit,
					// type: 5,
				}
				this.$Request.get("/app/orders/selectNowDayOrders", data).then(res => {
					uni.stopPullDownRefresh();
					if (res.code == 0) {
						this.pages = res.data.pages
						res.data.records.map(d => {
							if (d.appointInformation) {
								d.appointInformation.startData = d.appointInformation.hopeTime.substring(5,
									11)
								d.appointInformation.hopeTime = d.appointInformation.hopeTime.substring(5,
									16)
							}
						});
						if (this.page == 1) {
							this.orderlist = res.data.records
						} else {
							this.orderlist = [...this.orderlist, res.data.records]
						}
					}
				})
			},
			goDetail(index) {
				let userId = uni.getStorageSync('userId')
				if (userId) {
					if (index == 1) {
						uni.switchTab({
							url: '/pages/order/index'
						})
					} else if (index == 2) {
						uni.switchTab({
							url: '/pages/order/index'
						})
					}
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}

			},
			bindFb() {
				let userId = uni.getStorageSync('userId')
				this.classify = uni.getStorageSync('classify')
				if (userId) {
					if (this.geRen == 2) {
						uni.navigateTo({
							url: '/my/publish/index'
						})
					} else if (this.geRen == 1) {
						uni.showModal({
							title: '提示',
							content: '实名认证审核中,请稍等',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									// uni.navigateTo({
									// 	url: '/my/renzheng/index'
									// })
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						uni.showModal({
							title: '提示',
							content: '您还未实名认证,请先认证',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									uni.navigateTo({
										url: '/my/renzheng/index?classify=' + this.classify
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					}

				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			},
			//时间弹框开关
			bindData(index) {
				// console.log(index, 1111)
				if (index == 1) {
					this.startshow = true
				} else if (index == 2) {
					this.endshow = true

				}
			},
			//开始时间
			startData(e) {
				// console.log(e)
				this.startTime = e.year + '-' + e.month + '-' + e.day
			},
			// 结束时间
			endData(e) {
				this.endTime = e.year + '-' + e.month + '-' + e.day
				// console.log(this.endTime)
				this.getFb()
			},
			goNav(e, name) {
				console.log(e)
				if (this.userId) {
					uni.navigateTo({
						url: e
					})
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			},
			getUserInfo() {
				this.$Request.get("/app/user/selectUserById").then(res => {
					if (res.code == 0) {
						this.sumOrdersScore = res.data.finalScore //用户评价
						this.userName = res.data.userName
						this.invitationCode = res.data.invitationCode
						this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
						this.isAuthentication = res.data.isAuthentication
						this.isCashDeposit = res.data.isCashDeposit
						uni.setStorageSync('avatar', res.data.avatar)
						uni.setStorageSync('invitationCode', res.data.invitationCode)
						uni.setStorageSync('rate', res.data.rate)
						// uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
						// uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
					}
				});
			},
			goLogin(e) {
				uni.navigateTo({
					url: e
				})
			},
			// 开启订阅消息
			openMsg() {
				console.log('订阅消息')
				var that = this
				uni.getSetting({
					withSubscriptions: true, //是否获取用户订阅消息的订阅状态，默认false不返回
					success(ret) {
						console.log(ret.subscriptionsSetting, '------------------')
						// if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
						if (ret.subscriptionsSetting.itemSettings) {
							uni.setStorageSync('sendMsg', true)
							uni.openSetting({ // 打开设置页 
								success(rea) {
									console.log(rea.authSetting)
								}
							});
						} else { // 用户没有点击“总是保持以上，不再询问”则每次都会调起订阅消息
							console.log(99999)
							uni.setStorageSync('sendMsg', false)
							uni.showModal({
								title: '提示',
								content: '为了更好的体验,请绑定消息推送',
								confirmText: '确定',
								cancelText: '取消',
								success: function(res) {
									if (res.confirm) {
										uni.requestSubscribeMessage({
											tmplIds: that.arr,
											success(re) {
												console.log(JSON.stringify(re),
													'++++++++++++++')
												var datas = JSON.stringify(re);
												if (datas.indexOf("accept") != -1) {
													console.log(re)
													// uni.setStorageSync('sendMsg', true)
												}
											},
											fail: (res) => {
												console.log(res)
											}
										})
										// uni.setStorageSync('sendMsg', true)
										console.log('确认')
										that.showModal = false
									} else if (res.cancel) {
										console.log('取消')
										// uni.setStorageSync('sendMsg', false)
										that.showModal = true
									}
								}
							})
						}
					}
				})
			},
			// 个人认证数据
			getRenZheng() {
				let classify
				this.$Request.get("/app/userCertification/queryInsert").then(res => {
					console.log(res)
					if (res.code == 0) {
						if(res.data){
							this.authentication = res.data.authentication
							uni.setStorageSync("city", res.data.city)
							uni.setStorageSync("authentication", res.data.authentication)
						}
						if (res.data == null) {
							this.geRen = 0
							uni.setStorageSync("geRen", this.geRen)
						} else if (res.data.status == 0) {
							this.geRen = 1
							uni.setStorageSync("geRen", this.geRen)
						} else if (res.data.status == 1) {
							this.geRen = 2
							uni.setStorageSync("geRen", this.geRen)
						} else if (res.data.status == 2) {
							this.geRen = 3
							uni.setStorageSync("geRen", this.geRen)
						}
						
						
						
						
					}
				});
			},
		},
		onReachBottom: function() {
			if (this.page < this.pages) {
				this.page += 1
				this.getTodayOrder()
			}

		},
		onPullDownRefresh: function() {
			if (uni.getStorageSync('token')) {
				this.page = 1
				this.getFb();
				this.getTodayOrder()
			} else {
				uni.stopPullDownRefresh()
			}

		}
	}
</script>

<style lang="scss">
	page {
		background-color: #FFFFFF;
	}

	.swiper {
		width: 100%;
	}

	.bg {
		background-color: #FFFFFF;
	}

	.box {
		width: 690upx;
		margin: 0 auto;
		height: 120rpx;
		background: #0175FE;
		border-radius: 16upx 16upx 0px 0px;
		color: #FFFFFF;
		padding: 0upx 30upx;
		margin-top: 20upx;
	}

	.orderbox {
		width: 690upx;
		margin: 0 auto;
		height: 153upx;
		background: #FAFAFA;
		border-radius: 16upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		text-align: center;
		padding: 0upx 30upx;
	}

	.page-box {
		position: relative;
		left: 0;
		height: 50vh;
		background-color: #FFFFFF;
	}



	.data-box-item {
		width: 100%;
		height: 153rpx;
		background-color: #FAFAFA;
		border-radius: 16rpx;
		margin-top: 20rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.data-box-items:nth-of-type(1) {
			margin-left: 30rpx;
		}

		.data-box-items:nth-of-type(4) {
			margin-right: 30rpx;
		}

		.data-box-items {
			text-align: center;

			.data-box-items-t {
				color: #333333;
				font-size: 42rpx;

				span {
					font-weight: bold;
					font-size: 24rpx;
					margin-right: 5rpx;
				}
			}

			.data-box-items-b {
				color: #333333;
				font-size: 24rpx;
				margin-top: 15rpx;
			}
		}
	}

	.tadyOrder {
		width: 100%;
		height: 165rpx;
		border-radius: 16rpx;
		background-color: #FAFAFA;
		margin-top: 30rpx;
		display: flex;
		align-items: center;

		.tadyOrder-left {
			width: 207rpx;
			height: 108rpx;
			border-right: 1rpx solid #E6E6E6;
			text-align: center;

			.tadyOrder-left-t {
				color: #333333;
				font-size: 24rpx;
				margin-top: 10rpx;
			}

			.tadyOrder-left-b {
				color: #0175FE;
				font-size: 28rpx;
				margin-top: 15rpx;

			}
		}

		.tadyOrder-right {
			width: calc(100% - 207rpx);
			height: 100%;
			display: flex;
			flex-wrap: wrap;
			align-items: center;
			margin-top: 30rpx;
			align-content: flex-start;

			.tadyOrder-right-t {
				color: #1E1F31;
				font-size: 28rpx;
				font-weight: bold;
				margin-top: 22rpx;
				padding-left: 40rpx;
			}

			.tadyOrder-right-b {
				display: flex;
				color: #333333;
				font-size: 24rpx;
				margin-top: 10rpx;
				padding-left: 10rpx;
				margin-left: 30rpx;
			}
		}
	}

	.contentview {
		width: 632rpx;
		padding: 48rpx;
		box-sizing: border-box;
		background: #fff;
		border-radius: 16rpx;
	}

	.contentview .title {
		text-align: center;
		color: #333;
		font-weight: bold;
		font-size: 32rpx;
	}

	.contentview .des {
		font-size: 26rpx;
		color: #666;
		margin-top: 40rpx;
		text-align: justify;
		line-height: 1.6;
	}

	.contentview .des .link {
		color: #5074FF;
		text-decoration: underline;
	}

	button::after {
		border: none;
	}

	.btns {
		margin-top: 48rpx;
		display: flex;
	}

	.btns .item {
		justify-content: space-between;
		width: 244rpx;
		height: 80rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 16rpx;
		box-sizing: border-box;
		border: none;
	}

	.btns .reject {
		background: #f4f4f5;
		color: #909399;
	}

	.btns .agree {
		background: #5074FF;
		color: #fff;
	}
</style>